package o;

import android.content.Context;
import com.huawei.hianalytics.v2.HiAnalytics;
import com.huawei.hianalytics.v2.HiAnalyticsConf.Builder;
import com.huawei.hms.utils.HMSBIInit;
import java.util.LinkedHashMap;
import java.util.List;
import o.dqq.c;

public class dla {
    private static volatile boolean ˎ = false;

    static class a implements Runnable {
        private static final byte[] ॱ = new byte[0];
        private int ˋ;
        private LinkedHashMap<String, String> ˎ;
        private String ˏ;

        public a(int i, String str, LinkedHashMap<String, String> linkedHashMap) {
            this.ˋ = i;
            this.ˏ = str;
            this.ˎ = linkedHashMap;
        }

        public void run() {
            if (this.ˋ == 0) {
                synchronized (ॱ) {
                    ˎ();
                }
                return;
            }
            synchronized (ॱ) {
                ˋ();
            }
        }

        private void ˎ() {
            dlc ˋ = dlc.ˋ();
            if (ˋ != null) {
                List ˏ = ˋ.ˏ();
                for (int i = 0; i < ˏ.size(); i++) {
                    dlb o_dlb = (dlb) ˏ.get(i);
                    dgh.ˎ(o_dlb.ˎ, o_dlb.ॱ);
                }
                dlc.ॱ();
            }
        }

        private void ˋ() {
            dlc.ˋ(this.ˏ, this.ˎ);
        }
    }

    static class b implements c {
        private b() {
        }

        public void ˏ(String str) {
            if (dof.ˋ(str)) {
                Logger.e("OOBEBIHelper", "url is blank.");
                return;
            }
            Context ˋ = ContentManager.getInstant().getContext();
            Builder builder = new Builder(ˋ);
            builder.setCollectURL(0, str);
            builder.setCollectURL(1, str);
            String ˊ = bjx.ˊ();
            if (dof.ˋ(ˊ)) {
                ˊ = "";
            }
            builder.setUDID(ˊ);
            if (HiAnalytics.getInitFlag()) {
                builder.refresh(true);
            } else {
                builder.create();
            }
            HMSBIInit hMSBIInit = new HMSBIInit();
            if (hMSBIInit.isInit()) {
                hMSBIInit.refresh(ˋ, false, false, false, str, true);
            } else {
                hMSBIInit.init(ˋ, false, false, false, str);
            }
            dla.ˎ = true;
            Logger.ˎ("OOBEBIHelper", "BI SDK config OK.");
            dla.ˏ();
        }
    }

    public static void ˎ() {
        if (!ˎ) {
            new dqx(ContentManager.getInstant().getContext()).ˏ(new b());
        }
    }

    public static void ˎ(String str, LinkedHashMap<String, String> linkedHashMap) {
        if (ˎ) {
            dgh.ˎ(str, linkedHashMap);
        } else {
            cdx.ˊ(new a(1, str, linkedHashMap));
        }
    }

    private static void ˏ() {
        cdx.ˊ(new a(0, null, null));
    }
}
